#ifndef POINT2D_H
#define POINT2D_H

#include <math.h>
#include <string.h> // memcpy
#include <iostream>
using namespace std;

class Point2D
{
    public:
    
        Point2D();
        
        Point2D(int x, int y);
        
        double Length() const;
        
        const int GetX() const;
        const int GetY() const;
        
        /* Operators */

        Point2D operator + (const Point2D& b) const;
        void operator += (const Point2D& b);
        Point2D operator + (const int n) const;
        void operator += (const int n);

        void operator - ();
        Point2D operator - (const Point2D& b) const;
        void operator -= (const Point2D& b);
        Point2D operator - (const int n) const;
        void operator -= (const int n);

        Point2D operator * (const int n) const;
        void operator *= (const int n);

        Point2D operator / (const int n) const;
        void operator /= (const int n);

        friend ostream& operator << (ostream& os, const Point2D& v);
        
        size_t SizeOf() const;
        void Serialize(unsigned char* buffer) const;
        
        Point2D(unsigned char* buffer);
        
    private:
        
        int _x, _y;
};

#endif
